//
//  AttentionViewController.swift
//  HLSwiftWork
//
//  Created by hulinhu on 2018/6/8.
//  Copyright © 2018年 hulinhu. All rights reserved.
//

import UIKit
import SnapKit

class AttentionViewController: HLBaseViewController {

    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setupNavgationBar()
        setupUI()
  }
   
}


// MARK: - 设置导航栏
extension AttentionViewController {
    
    
    fileprivate func setupUI(){
        
       let imageView  = UIImageView()
        imageView.image = UIImage.init(named: "header_cry_icon")
        view.addSubview(imageView)
        
        imageView.snp.makeConstraints { (make) in
            make.top.equalTo(self.view).offset(105)
            make.centerX.equalTo(self.view)
            make.width.height.equalTo(48)
        }
        
        let title = """
                快快登录吧, 关注百思最in牛人
                好友动态让你过把瘾儿~
                欧耶~~~~!
               """
        
        let titleLabel = UILabel()
        titleLabel.text = title
        titleLabel.numberOfLines = 0;
        titleLabel.textAlignment = .center
        titleLabel.textColor = UIColor.gray
        titleLabel.font = UIFont.systemFont(ofSize: 17)
        view.addSubview(titleLabel)
        
        titleLabel.snp.makeConstraints { (make) in
            make.top.equalTo(imageView.snp.bottom).offset(10)
            make.centerX.equalTo(self.view)
            make.width.equalTo(243)
            make.height.equalTo(80)
        }

        
        let loginBtn = UIButton.init(type: .custom)
        loginBtn.setTitle("立即登录注册", for:.normal)
        loginBtn.setTitleColor(UIColor.red, for: .normal)
        loginBtn.layer.cornerRadius = 3
        loginBtn.layer.borderWidth = 1
        loginBtn.layer.borderColor = UIColor.red.cgColor
        loginBtn.addTarget(self, action: #selector(loginBtnClicked), for: .touchUpInside)
        view.addSubview(loginBtn)
        
        loginBtn.snp.makeConstraints { (make) in
            make.top.equalTo(titleLabel.snp.bottom).offset(20)
            make.centerX.equalTo(self.view)
            make.width.equalTo(243)
            make.height.equalTo(44)
        }
        
    }
    
    fileprivate func setupNavgationBar() {
        navigationItem.title = "关注"
        navigationItem.leftBarButtonItem = UIBarButtonItem (image: "friendsRecommentIcon", highImage: "friendsRecommentIcon-click", target: self, action: #selector(tagClick))
    }

}

// MARK: - 点击事件
extension AttentionViewController {
    
    @objc fileprivate func tagClick(){
        let vc = RecommendViewController()
        navigationController?.pushViewController(vc, animated: true)
    }
    
   @objc fileprivate func loginBtnClicked(_ sender: UIButton) {
        let vc = LoginRegisterViewController()
        present(vc, animated: true, completion: nil)
    }
}
